package br.com.mubi.comentario;

import java.util.List;

import org.hibernate.SQLQuery;
import org.hibernate.Session;

public class ComentarioDAOHibernate implements ComentarioDAO {
	
	private Session session;
	
	public void setSession(Session session){
		this.session = session;
	}

	public void salvar(Comentario comentario) {
		this.session.save(comentario);
	}

	@SuppressWarnings("unchecked")
	public List<Comentario> listarComentarioFilmePorId(long id) {
		SQLQuery query = this.session.createSQLQuery("Select * from comentario where id_filme = " + id);
		return (List<Comentario>) query.list();
	}

}
